﻿<shared:PageBase x:Class="Bymed.SpineScan.WPF.AttendingDoctorSetupPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:shared="clr-namespace:Bymed.SpineScan.WPF.Shared"
      xmlns:validationRule="clr-namespace:Bymed.SpineScan.WPF.ValidationRules"
      x:Name="CurrentPage"        
      mc:Ignorable="d" 
      d:DesignHeight="1000" d:DesignWidth="1280"
	  Title="AttendingDoctorSetupPage" Style="{StaticResource DefaultPageStyle}" 
     Loaded="CurrentPage_Loaded"
      DataContext="{Binding AttendingDoctorSetup, Source={StaticResource Locator}}">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Skins/Storyboard/PageStoryborad.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <!-- Main Content -->
            <RowDefinition Height="Auto" />
            <!-- Navigation Buttons -->
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid>
            <Grid.Background>
                <ImageBrush ImageSource="/Skins/Resource/Image/GrayRightAboveTabBackground.png" />
            </Grid.Background>
            <Grid>
                <Grid.RowDefinitions>
                    <!-- Page Title -->
                    <RowDefinition Height="55" />
                    <!-- Data Management Functions -->
                    <RowDefinition />
                </Grid.RowDefinitions>
                <TextBlock Text="主治医生配置" Margin="0,15,15,0" HorizontalAlignment="Right" Style="{StaticResource PageTitleTextBlock}" />
                <Grid Grid.Row="1" Margin="20,0,20,0" Height="500">
                    <Grid.ColumnDefinitions>
                        <!-- Message List -->
                        <ColumnDefinition />
                        <!-- Up, Down & Remove Button -->
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <DataGrid x:Name="AttendingDoctorList" SelectedItem="{Binding SelectedAttendingDoctor}" 
                              Style="{StaticResource EditableDataGrid}" Height="480">
                        <DataGrid.RowValidationRules>
                            <validationRule:AttendingDoctorNameValidationRule ValidationStep="UpdatedValue" />
                        </DataGrid.RowValidationRules>
                        <DataGrid.Columns>
                            <DataGridTextColumn Width="*" Header="医生姓名" Binding="{Binding Name}" />
                        </DataGrid.Columns>
                    </DataGrid>
                    <Grid Grid.Column="1">
                        <Grid.RowDefinitions>
                            <!-- Up Button -->
                            <RowDefinition Height="Auto" />
                            <!-- Down Button -->
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>
                        <Button ToolTip="上移" HorizontalAlignment="Left" Tag="/Skins/Resource/Image/Up.png" 
                                Command="{Binding MoveUpCommand}" CommandParameter="{Binding SelectedIndex, ElementName=AttendingDoctorList}" 
                                Style="{StaticResource NavigationButton}" />
                        <Button Grid.Row="1" ToolTip="下移" HorizontalAlignment="Left" Tag="/Skins/Resource/Image/Down.png" 
                                Command="{Binding MoveDownCommand}" CommandParameter="{Binding SelectedIndex, ElementName=AttendingDoctorList}" 
                                Style="{StaticResource NavigationButton}" />
                    </Grid>
                </Grid>
            </Grid>
        </Grid>
        <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Content="保存并返回" Margin="0,0,120,0" Tag="/Skins/Resource/Image/Save.png" Style="{StaticResource NavigationButton}" Command="{Binding SaveCommand}" />
            <Button Content="取消并返回" Margin="0,0,120,0" Tag="/Skins/Resource/Image/Cancel.png" Style="{StaticResource NavigationButton}" Click="ButtonCancel_Click" />
        </StackPanel>
    </Grid>
</shared:PageBase>
